<template>
    <div class="card-detail">
        <div class="top-btn">
            <p class="revoke">联系墙主撕掉该便签</p>
            <p class="report">举报</p>
        </div>
        <note-card-vue :note="card"></note-card-vue>
        <div class="form">
            <textarea placeholder="请输入内容..." class="message"></textarea>
            <div class="btn">
                <input type="text" placeholder="匿名" class="name">
                <button-vue class="button">评论</button-vue>
            </div>
        </div>
        <!-- 留言部分 -->
        <p class="title">评论{{card.comment}}</p>
        <div class="comment">
            <div class="comment-li" v-for="(item, index) in comment.data" :key="index">
                <div class="user-head" :style="{backgroundImage: portrait[item.imgurl]}"></div>
                <div class="comm-msg">
                    <div class="msg-top">
                        <p class="name">{{item.name}}</p>
                        <p class="time">{{dateOne(item.moment)}}</p>
                    </div>
                    <div class="msg">{{item.message}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import NoteCardVue from './NoteCard.vue';
import ButtonVue from './Button.vue';
import { comment } from '../../mock/index'
import { portrait } from '@/utils/data'
import { dateOne } from '@/utils/tools'
// import { onMounted } from 'vue';

const props = defineProps({
    card: {
        default: {}
    }
})
// onMounted(() => {
//     console.log(comment)
// })
</script>

<style lang="less" scoped>
.card-detail {
    position: relative;
    padding: 0 @padding-20;
    box-sizing: border-box;

    .top-btn {
        position: fixed;
        top: 0px;
        left: 0;
        display: flex;
        // align-items: center;
        padding: 20px;

        .revoke {
            margin-right: 30px;
            color: @primary-color;
            cursor: pointer;
            font-size: @font-16;
        }

        .report {
            font-size: @font-16;
            color: @warning-color;
            cursor: pointer;
        }
    }

    .form {
        padding-top: @padding-12;

        .message {
            width: 100%;
            height: 56px;
            background: none;
            padding: @padding-8;

            resize: none;
            box-sizing: border-box;
            border: 1px solid rgba(148, 148, 148, 1);
        }

        .btn {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .name {
                width: 200px;
                padding: @padding-8;
                box-sizing: border-box;
                background: none;
                border: 1px solid rgba(148, 148, 148, 1);
                line-height: 20px;
            }

            .button {
                height: 36px;
                color: @gray-10;
            }
        }
    }

    .title {
        font-weight: 600;
        padding-top: 30px;
        padding-bottom: @padding-20;
    }

    .comment {
        .comment-li {
            display: flex;
            padding-bottom: 30px;

            .user-head {
                flex: none;
                width: 28px;
                height: 28px;
                border-radius: 50%;
            }

            .comm-msg {
                padding-left: @padding-8;

                .msg-top {
                    display: flex;
                    align-items: center;

                    .name {
                        font-weight: 600;
                    }

                    .time {
                        font-size: @font-12;
                        padding-left: @padding-4;
                        color: @gray-2;
                    }
                }

                .msg {
                    padding-top: @padding-4;
                }
            }
        }
    }
}
</style>